home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / patchSG0003743.idb / usr / include / cray / format.h.z / format.h
C/C++ Source or Header  |  2001-04-12  |  6KB  |  233 lines

  1. /* USMID @(#) clibinc/cray/format.h    92.0    10/08/98 14:28:05 */
  2. /*
  3.  *    (C) COPYRIGHT CRAY RESEARCH, INC.
  4.  *    UNPUBLISHED PROPRIETARY INFORMATION.
  5.  *    ALL RIGHTS RESERVED.
  6.  */
  7. #ifndef    _CRAY_FORMAT_H
  8. #define    _CRAY_FORMAT_H
  9.  
  10. #ifndef    NULL
  11. #   define    NULL    0
  12. #endif
  13.  
  14. #ifndef    FALSE
  15. #   define    FALSE    0
  16. #endif
  17.  
  18. #ifndef    TRUE
  19. #   define    TRUE    1
  20. #endif
  21.  
  22. /*
  23.  * The following symbol identifies the level of the current parser.  If
  24.  * the library is passed a parsed format with a different level than it's
  25.  * expecting, it will reparse the format.
  26.  */
  27.  
  28. #define    PARSER_LEVEL    3    /* Identifying level of the parser */
  29.  
  30. /* Edit descriptors and operators which appear in the parsed format */
  31.  
  32. #define FIRST_DATA_ED    1
  33. #define A_ED        1
  34. #define B_ED        2
  35. #define D_ED        3
  36. #define E_ED        4
  37. #define EN_ED        5
  38. #define ES_ED        6
  39. #define F_ED        7
  40. #define G_ED        8
  41. #define I_ED        9
  42. #define L_ED        10
  43. #define O_ED        11
  44. #define R_ED        12    /* CRI extension */
  45. #define Z_ED        13
  46. #define    Q_ED        14    /* MIPSpro extension */
  47. #define LAST_DATA_ED    14
  48.  
  49. #define FIRST_CNTL_ED    20
  50. #define SLASH_ED    20
  51. #define P_ED        21
  52. #define STRING_ED    22
  53. #define BN_ED        23
  54. #define BZ_ED        24
  55. #define COLON_ED    25
  56. #define S_ED        26
  57. #define SP_ED        27
  58. #define SS_ED        28
  59. #define TL_ED        29
  60. #define TR_ED        30
  61. #define T_ED        31
  62. #define DOLLAR_ED    32    /* CRI extension */
  63. #define LAST_CNTL_ED    32
  64.  
  65. #define    FIRST_OP    40
  66. #define REPEAT_OP    40
  67. #define ENDREP_OP    41
  68. #define REVERT_OP    42
  69. #define LAST_OP        42    /* Last valid format operator */
  70.  
  71. /* There are dependencies on this order */
  72.  
  73. #ifdef    _OLD_ERROR_NUMBERS
  74.  
  75. #define END_OF_MESSAGES            0
  76. #define TRAILING_CHARS            1
  77. #define FIELD_TOO_SMALL            2    /* Deprecated */
  78.  
  79. #define FIRST_NON_ANSI_MESSAGE        3
  80. #define ANSI_EMPTY_PAREN_MSG        3
  81. #define ANSI_COMMA_REQ            4
  82. #define COMMA_NON_ANSI            5
  83. #define REP_SLASH_NON_ANSI        6
  84. #define NON_ANSI_EDIT_DESCRIPTOR    7
  85. #define MINUS_X_NON_ANSI        8
  86. #define E_WITH_D_NON_ANSI        9
  87. #define    H_IS_OBSOLETE_IN_F90        10
  88. #define LAST_NON_ANSI_MESSAGE        10
  89.  
  90. #define FIRST_FATAL_MESSAGE        11
  91. #define EXPECTING_LEFT_PAREN        11
  92. #define EXPECTING_RIGHT_PAREN        12
  93. #define EXPECTING_INTEGER        13
  94. #define EXPECTING_PERIOD        14
  95. #define EXPECTING_P_OR_X        15
  96. #define INVALID_REP_COUNT        16
  97. #define ZERO_REP_COUNT            17
  98. #define FIELD_WIDTH_ZERO        18
  99. #define FIELD_TOO_LARGE            19
  100. #define ZERO_OR_NO_HOLLERITH_CNT    20
  101. #define UNKNOWN_EDIT_DESCRIPTOR        21
  102. #define NONTERMINATED_LITERAL        22
  103. #define UNABLE_TO_MALLOC_MEMORY        23
  104.  
  105. #else    /* _OLD_ERROR_NUMBERS */
  106.  
  107. #define END_OF_MESSAGES            0
  108. #define FIRST_WARNING_MESSAGE        1
  109. #define TRAILING_CHARS            1
  110.  
  111. #define FIRST_NON_ANSI_MESSAGE        10
  112. #define ANSI_EMPTY_PAREN_MSG        10
  113. #define ANSI_COMMA_REQ            11
  114. #define COMMA_NON_ANSI            12
  115. #define REP_SLASH_NON_ANSI        13
  116. #define NON_ANSI_EDIT_DESCRIPTOR    14
  117. #define MINUS_X_NON_ANSI        15
  118. #define E_WITH_D_NON_ANSI        16
  119. #define    H_IS_OBSOLETE_IN_F90        17
  120. #define    NON_ANSI_NULL_DESCRIPTOR    18
  121. #define    ZERO_WIDTH_NON_ANSI        19
  122. #define    MISSING_WIDTH_NON_ANSI        20
  123. #define LAST_NON_ANSI_MESSAGE        20
  124.  
  125. #define FIRST_FATAL_MESSAGE        30
  126. #define EXPECTING_LEFT_PAREN        30
  127. #define EXPECTING_RIGHT_PAREN        31
  128. #define EXPECTING_INTEGER        32
  129. #define EXPECTING_PERIOD        33
  130. #define EXPECTING_P_OR_X        34
  131. #define INVALID_REP_COUNT        35
  132. #define ZERO_REP_COUNT            36
  133. #define FIELD_WIDTH_ZERO        37
  134. #define FIELD_TOO_LARGE            38
  135. #define ZERO_OR_NO_HOLLERITH_CNT    39
  136. #define UNKNOWN_EDIT_DESCRIPTOR        40
  137. #define NONTERMINATED_LITERAL        41
  138. #define UNABLE_TO_MALLOC_MEMORY        42
  139.  
  140. #endif    /* !_OLD_ERROR_NUMBERS */
  141.  
  142. #define DW_IS_NON_ANSI            E_WITH_D_NON_ANSI
  143.  
  144. /* Compiler level masks */
  145.  
  146. #define    FALL                ~00    /* All levels */
  147. #define    F77                001    /* Fortran 77 */
  148. #define    F90                002    /* Fortran 90 */
  149. #define    F95                004    /* Fortran 95 */
  150.  
  151. /* Format parser call flags */
  152.  
  153. #define LIB_CALL            0
  154. #define COMPILER_CALL_ANSI        1    /* Obsolete */
  155. #define COMPILER_CALL_NO_ANSI        2
  156. #define COMPILER_CALL_ANSI_77        3
  157. #define COMPILER_CALL_ANSI_90        4
  158. #define COMPILER_CALL_ANSI_95        5
  159. #define    MAX_CALL_FLAG            5
  160.  
  161. #define MAX_EXPONENT            077
  162. #define MAX_FIELD_WIDTH            077777777
  163. #define MAX_DECIMAL_FIELD        077777777
  164. #define MAX_REP_COUNT            017777777777
  165.  
  166.  
  167. struct    msg_entry {
  168.     unsigned int    msg_number    : 7;
  169.     unsigned int    reserved    : 9;
  170.     unsigned int    msg_column    : 24;
  171.     unsigned int    desc_column    : 24;
  172. };
  173.  
  174. typedef struct    msg_entry    msg_type;
  175.  
  176. /*
  177.  *    Note: If we ever have to change the structure of the
  178.  *    fmt_entry, we should ensure that no fields span a
  179.  *    32-bit boundary.  This will help ensure a more compact
  180.  *    structure on _WORD32 systems.
  181.  */
  182.  
  183. struct    fmt_entry {
  184.     unsigned int    op_code        : 7;
  185.     unsigned int    default_digits    : 1;
  186.     unsigned int    digits_field     : 24;    /* 1 32-bit word */
  187.     unsigned int    exponent    : 6;
  188.     unsigned int    reserved2    : 2;
  189.     unsigned int    field_width    : 24;    /* 1 64-bit word */
  190.  
  191.     unsigned int    rgcdedf        : 1;
  192.     unsigned int    reserved3    : 15;
  193.     unsigned int    offset        : 16;    /* 3 32-bit words */
  194.     signed    int    rep_count     : 32;    /* 2 64-bit words*/
  195. };
  196.  
  197. typedef    struct    fmt_entry    fmt_type;
  198.  
  199. #define FMT_ENTRY_BYTE_SIZE    sizeof(fmt_type)
  200.  
  201. /*
  202.  * Caution: FMT_ENTRY_WORD_SIZE will vary on mips systems with the
  203.  * sizeof(long).
  204.  */
  205.  
  206. #define FMT_ENTRY_WORD_SIZE    (sizeof(fmt_type)/sizeof(long))
  207.  
  208. /* Function prototypes */
  209.  
  210. typedef void    _Error_function(const int _Msg_num,
  211.         const int _Error_offset,
  212.         const int _Edit_desc_offset);
  213.  
  214. extern fmt_type *
  215. _parsfmt(
  216.     _Error_function    **_Msg_rtn,
  217.     char        *_Format_str,
  218.     long int    _Routine_caller,
  219.     long int    *_Fmt_str_len,
  220.     msg_type    *_Lib_err_msg
  221. );
  222.  
  223. extern fmt_type *
  224. _fmt_parse(
  225.     _Error_function    **_Msg_rtn,
  226.     char        *_Format_str,
  227.     long int    _Routine_caller,
  228.     long int    *_Fmt_str_len,
  229.     msg_type    *_Lib_err_msg
  230. );
  231.  
  232. #endif /* !_CRAY_FORMAT_H */
  233.